package com.lm.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.Arrays;

/**
 * @author LM
 * @date 2025/2/7 22:16
 */
@AllArgsConstructor
@NoArgsConstructor
@Getter
public enum DistributedLockTypeEnum {

    REDIS("REDIS"),
    ZOOKEEPER("ZOOKEEPER"),
    MYSQL("MYSQL"),
    NULL("NULL");

    private String type;

    public static DistributedLockTypeEnum getEnumByValue(String lockType) {
        return Arrays.stream(DistributedLockTypeEnum.values()).filter(e -> e.getType().equals(lockType)).findFirst().orElse(NULL);
    }
}
